package demo.Controller;

import cn.springmix.base.lang.entity.ResponseResult;
import cn.springmix.base.lang.exception.Exceptions;
import cn.springmix.core.annotation.NotAutoResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;


/**
 * @author xufeng
 * @description: 测试一下包装类 和全局异常
 * @date 2022-04-20 13:47
 */
@Slf4j
@RestController
@RequestMapping
@Validated
public class TestController {


    @GetMapping("/test")
    @NotAutoResult
    public ResponseResult hello() {
        Exceptions.msg("error.param.format");
        return ResponseResult.OK("hello");
    }

    @GetMapping("/test1")
    @NotAutoResult
    public ResponseResult hello(@NotNull(message = "{error.param.format}") String id) {
        //Exceptions.msg("error.param.format");
        return ResponseResult.OK("hello");
    }
}
